<template>
	<view class="email__container">
		<input class="user__set__input" type="email" placeholder="输入邮箱" v-model="email"/>
		<input class="user__set__input" type="text"  placeholder="输入密码" password v-model="password"/>
		<button type="default" class="user__set__btn" :loading="isloading" :class="[{'user__set__btn--disable':isEnabled}]" @tap="submit">完成</button>
	</view>
</template>

<script setup>
	import {check} from '../../common/verification.js'
	import {ref,computed} from 'vue';
	
	const isloading = ref(false)
	
	const email = ref("");
	const password = ref("")
	
	const isEnabled = computed(()=>{
		return email.value!=''&&password.value!='';
	})
	
	function submit(){
		if(!(check(email.value,/^[a-zA-Z0-9][a-zA-Z0-9_]+\@[a-zA-Z0-9]+\.[a-zA-Z]{2,5}(\.[a-zA-Z]{2,5})*$/i,"邮箱格式不正确")
		&&check(password.value,/^\w{4,16}$/,"密码长度{4,16}"))){
			return false;
		}
		
		
	}
	
</script>

<style scoped lang="scss">
	@import '../../common/from.scss';
 .email__container{
	 padding: 20upx;
	 width: 100%;
	 box-sizing: border-box;
	
	 
 }
</style>
